home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / utils / sound / players / unix / xtank / xtank13d.1 < prev   
Encoding:
Text File  |  1993-01-31  |  29.5 KB  |  1,064 lines

  1. #
  2. # xtank1.3d-sound-patches version 1.1
  3. #
  4. # This sound patch to xtank1.3d will only work on Suns workstations
  5. # with sound support.
  6. #
  7. # Note:    This is a patch to an original xtank1.3d _not_ a patch to the
  8. #     previous sound patch.
  9. #
  10. # This is version 1.1 of the xtank-sound-patches.  The following things
  11. # have been added/changed to the previous patch:
  12. #
  13. #     - Sounds only play on your workstation if the source of the sound is
  14. #        visible. (Thanks to Brian Stormont, brs@cs.brown.edu)
  15. #
  16. #    - Different sounds for each type of explosion (electricity, dam0, dam1,
  17. #        etc). (Thanks to Brian Stormont, brs@cs.brown.edu)
  18. #
  19. #    - Sound for the 1960s style radar.  A sound is played for each blip.
  20. #        (Thanks to Brian Stormont, brs@cs.brown.edu)
  21. #
  22. #    - Sound can be turned on/off in the settings-flags menu.
  23. #
  24. # This patch will only work on an original xtank1.3d (as far as I know)
  25. # For sounds to work you must also have the rplay package installed
  26. # on all machines using xtank, this means the server and clients.
  27. # If rplay is not installed on a client machine that client will not
  28. # receive any of the sounds.  The rplay package along with the sound 
  29. # files are available via anonymous ftp at sciences.sdsu.edu.
  30. # The Imakefile in the Src directory also is setup to link with the 
  31. # librplay.a in /usr/local/lib.  If you changed the directory where 
  32. # librplay.a lives you will have to edit the Imakefile in Src.
  33. #
  34. # To apply the sound patch...
  35. # % cd your_xtank_directory (the one with Imakefile.Config)
  36. # % patch -p0 < sound-patches >& patchresults
  37. #
  38. # There is a new directory called Sound which contains a file
  39. # called list.  This file contains a list of all the sound file names
  40. # that are to be used for the appropriate xtank sounds.
  41. #
  42. # Send problems/questions/comments to boyns@sciences.sdsu.edu.
  43. #
  44. # Mark
  45. #
  46. *** /dev/null    Wed Jul  8 10:41:50 1992
  47. --- Sounds/list    Wed Jul  8 10:29:04 1992
  48. ***************
  49. *** 0 ****
  50. --- 1,46 ----
  51. + #
  52. + # This file contains the names of the sound files used for sounds.
  53. + # The numbers in the first column represent the number associated
  54. + # with the #defines in Src/Include/Sound.h.
  55. + # When adding new sounds changes must be made both to the Sound.h
  56. + # and this list.  To change a sound just change the name here.
  57. + #
  58. + 0    click1.au        # lmg
  59. + 1    click1.au        # mg 
  60. + 2    click1.au        # hmg 
  61. + 3    click1.au        # lrifle 
  62. + 4    click1.au        # rifle 
  63. + 5    click1.au        # hrifle 
  64. + 6    click1.au        # lcannon 
  65. + 7    click1.au        # cannon 
  66. + 8    click1.au        # hcannon 
  67. + 9    click1.au        # lrocket 
  68. + 10     click1.au        # rocket 
  69. + 11    click1.au        # hrocket 
  70. + 12    click1.au        # acid 
  71. + 13    click1.au        # flame 
  72. + 14    drip.au            # mine 
  73. + 15    Missle1.au        # seeker 
  74. + 16    click1.au        # slick 
  75. + 17    click1.au        # procket 
  76. + 18    click1.au        # umissle 
  77. + 19    click1.au        # harm 
  78. + 20    click1.au        # disc 
  79. + 21    bong.au            # vehicle hit wall
  80. + 22    better_boing.au        # vehicle hit vehicle
  81. + 23    arrp.au            # bullet hit vehicle
  82. + 24    tap2.au            # bullet hit wall
  83. + 25    boom.au            # tank explosion
  84. + 26    arrp.au            # gleam explosion
  85. + 27    arrp.au            # dam0 explosion
  86. + 28    arrp.au            # dam1 explosion
  87. + 29    arrp.au            # dam2 explosion
  88. + 30    arrp.au            # dam3 explosion
  89. + 31    arrp.au            # dam4 explosion
  90. + 32    arrp.au            # exhaust explosion
  91. + 33    arrp.au            # electric explosion
  92. + 34    arrp.au            # damage explosion
  93. + 35    sub_dive_horn.au    # start
  94. + 36    game_over.au        # end
  95. + 37    Sonar.au        # sonar
  96. + 38    blip.au            # blip
  97. *** /dev/null    Wed Jul  8 10:41:50 1992
  98. --- Src/Include/sound.h    Wed Jul  8 10:27:52 1992
  99. ***************
  100. *** 0 ****
  101. --- 1,66 ----
  102. + #ifndef    _sound_h
  103. + #define    _sound_h
  104. + /*
  105. +  * This file contains the sound indexes into the sound table
  106. +  * The indexes here must be consistent with those in the file Sounds/list
  107. +  */
  108. + /*
  109. +  * maximum number of sounds
  110. +  */
  111. + #define MAX_SOUNDS            128
  112. + /*
  113. +  * sounds for all the types of weapons
  114. +  */
  115. + #define LMG_SOUND            0
  116. + #define MG_SOUND            1
  117. + #define HMG_SOUND            2
  118. + #define LRIFLE_SOUND            3
  119. + #define RIFLE_SOUND            4
  120. + #define HRIFLE_SOUND            5
  121. + #define LCANNON_SOUND            6
  122. + #define CANNON_SOUND            7
  123. + #define HCANNON_SOUND            8
  124. + #define LROCKET_SOUND            9
  125. + #define ROCKET_SOUND            10
  126. + #define HROCKET_SOUND            11
  127. + #define ACID_SOUND            12
  128. + #define FLAME_SOUND            13
  129. + #define MINE_SOUND            14
  130. + #define SEEKER_SOUND            15
  131. + #define SLICK_SOUND            16
  132. + #define PROCKET_SOUND            17
  133. + #define UMISSLE_SOUND            18
  134. + #define HARM_SOUND            19
  135. + #define DISC_SOUND            20
  136. + /*
  137. +  * things hitting things sounds
  138. +  */
  139. + #define VEHICLE_HIT_WALL_SOUND        21
  140. + #define VEHICLE_HIT_VEHICLE_SOUND    22
  141. + #define BULLET_HIT_VEHICLE_SOUND    23
  142. + #define BULLET_HIT_WALL_SOUND        24
  143. + /*
  144. +  * explosion sounds
  145. +  */
  146. + #define TANK_EXPLOSION_SOUND        25
  147. + #define GLEAM_EXPLOSION_SOUND        26
  148. + #define DAM0_EXPLOSION_SOUND        27
  149. + #define DAM1_EXPLOSION_SOUND        28
  150. + #define DAM2_EXPLOSION_SOUND        29
  151. + #define DAM3_EXPLOSION_SOUND        30
  152. + #define DAM4_EXPLOSION_SOUND        31
  153. + #define EXHAUST_EXPLOSION_SOUND        32
  154. + #define ELECTRIC_EXPLOSION_SOUND    33
  155. + #define DAMAGE_EXPLOSION_SOUND        34
  156. + /*
  157. +  * misc sounds
  158. +  */
  159. + #define START_SOUND            35
  160. + #define END_SOUND            36
  161. + #define SONAR_SOUND            37
  162. + #define BLIP_SOUND            38
  163. + #endif    _sound_h
  164. *** /dev/null    Wed Jul  8 10:41:50 1992
  165. --- Src/sound.c    Mon Jul  6 11:34:55 1992
  166. ***************
  167. *** 0 ****
  168. --- 1,206 ----
  169. + #include "limits.h"
  170. + #include "xtank.h"
  171. + #include "graphics.h"
  172. + #include "gr.h"
  173. + #include "xtanklib.h"
  174. + #include "vehicle.h"
  175. + #include "globals.h"
  176. + #include "terminal.h"
  177. + #include "assert.h"
  178. + #include <sys/types.h>
  179. + #include <sys/param.h>
  180. + #include <sys/socket.h>
  181. + #include <netinet/in.h>
  182. + #include <netdb.h>
  183. + #include <stdio.h>
  184. + #ifdef SOUND
  185. + #include "sound.h"
  186. + extern Terminal    *terminal[];
  187. + extern int    num_terminals;
  188. + extern Settings    settings;
  189. + /*
  190. +  * the sound table
  191. +  */
  192. + int    sound_table[MAX_TERMINALS][MAX_SOUNDS];
  193. + /*
  194. +  * initialize sound for the given terminal
  195. +  */
  196. + init_terminal_sound(t)
  197. + Terminal    *t;
  198. + {
  199. +     int        index, id, bind_fd;
  200. +     char        *p, *rindex();
  201. +     char        host[MAXHOSTNAMELEN], buf[MAXPATHLEN], name[MAXPATHLEN];
  202. +     Video        *vidptr;
  203. +     extern char    pathname[], soundsdir[];
  204. +     char        filename[MAXPATHLEN];
  205. +     FILE        *fp;
  206. +     draw_text_rc(ANIM_WIN, 0, 1, "Initializing Sounds...", M_FONT, WHITE);
  207. +     sync_output(TRUE);
  208. +     /*
  209. +      * get the display hostname 
  210. +      */
  211. +     vidptr = (Video *)t->video;
  212. +     sprintf(host, "%s", vidptr->display_name);
  213. +     p = rindex(host, ':');
  214. +     *p = '\0';
  215. +     if (*host == '\0') {
  216. +         strcat(host, "localhost");
  217. +     }
  218. +     /*
  219. +      * initialize rplayd connection
  220. +      */
  221. +     t->rplay_fd = rplay_init(host);
  222. +     if (t->rplay_fd < 0) {
  223. +         rplay_perror(host);
  224. +         return -1;
  225. +     }
  226. +     /*
  227. +      * initialize rplaybindd connection
  228. +      */
  229. +     bind_fd = rplaybind_init(host);
  230. +     if (bind_fd < 0) {
  231. +         rplay_perror(host);
  232. +         close(t->rplay_fd);
  233. +         t->rplay_fd = -1;
  234. +         return -1;
  235. +     }
  236. +     strcpy(filename, pathname);
  237. +     strcat(filename, "/");
  238. +     strcat(filename, soundsdir);
  239. +     strcat(filename, "/");
  240. +     strcat(filename, "list");
  241. +     fp = fopen(filename, "r");
  242. +     if (fp == NULL) {
  243. +         fprintf(stderr, "Could not open file %s.\n", filename);
  244. +         exit(1);
  245. +     }
  246. +     /*
  247. +      * bind all the sounds in the sounds list to the host
  248. +      * store the returned sound ids in the sound table
  249. +      */
  250. +     while(fgets(buf, sizeof(buf), fp) != NULL) {
  251. +         if (buf[0] == '#' || buf[0] == '\n') continue;
  252. +         sscanf(buf, "%d %s", &index, name);
  253. +         id = rplaybind(bind_fd, name);
  254. +         if (id < 0) {
  255. +             rplay_perror(host);
  256. +             t->rplay_fd = -1;
  257. +             return -1;
  258. +         }
  259. +         if (id == 0) {
  260. +             fprintf(stderr, "%s not found at %s\n", name, host);
  261. +             id = -1;
  262. +         }
  263. +         sound_table[t->num][index] = id;
  264. +     } 
  265. +     /*
  266. +      * close the rplaybindd connection
  267. +      */
  268. +     close(bind_fd);
  269. +     play_terminal(t, SONAR_SOUND);
  270. +     return 0;
  271. + }
  272. + /*
  273. +  * play a sound on a terminal
  274. +  */
  275. + play_terminal(t, index)
  276. + Terminal    *t;
  277. + int        index;
  278. + {
  279. +     if (!settings.si.no_sound) {
  280. +         if (t->rplay_fd > 0 && sound_table[t->num][index] > 0)
  281. +             rplay(t->rplay_fd, sound_table[t->num][index]);
  282. +     }
  283. + }
  284. + /*
  285. +  * play a sound on all terminals
  286. +  */
  287. + play_all(index)
  288. + int    index;
  289. + {
  290. +     if (!settings.si.no_sound) {
  291. +         int    x;
  292. +     
  293. +         for(x = 0; x < num_terminals; x++)
  294. +             if (terminal[x]->rplay_fd > 0 && sound_table[terminal[x]->num][index] > 0)
  295. +                 rplay(terminal[x]->rplay_fd, sound_table[terminal[x]->num][index]);
  296. +     }
  297. + }
  298. + /*
  299. +  * play a sound on the terminal "owning" or watching this tank
  300. +  */
  301. + play_owner(vehicle, index)
  302. + Vehicle        *vehicle;
  303. + int        index;
  304. + {
  305. +     if (!settings.si.no_sound) {
  306. +         int    x, y;
  307. +         for (x = 0; x < vehicle->owner->num_players; x++) {
  308. +             y = vehicle->owner->player[x];
  309. +             if (terminal[y]->rplay_fd > 0 && sound_table[terminal[y]->num][index] > 0)
  310. +                 rplay(terminal[y]->rplay_fd, sound_table[terminal[y]->num][index]);
  311. +         }
  312. +     }
  313. + }
  314. + /*
  315. +  * play a sound on the terminal that has this location in view
  316. +  */
  317. + play_in_view(loc, index)
  318. + Loc    *loc;
  319. + int    index;
  320. + {
  321. +     if (!settings.si.no_sound) {
  322. +         int    x, dx, dy;
  323. +         int    t_x = loc->x;
  324. +         int    t_y = loc->y;
  325. +         for (x = 0; x < num_terminals; x++) {
  326. +             dx = t_x - terminal[x]->loc.x;
  327. +             dy = t_y - terminal[x]->loc.y;
  328. +             if (dx >= 0 && dx <= ANIM_WIN_WIDTH && dy >= 0 && dy <= ANIM_WIN_HEIGHT &&
  329. +                 terminal[x]->rplay_fd > 0 && sound_table[terminal[x]->num][index] > 0)
  330. +                 rplay(terminal[x]->rplay_fd, sound_table[terminal[x]->num][index]);
  331. +         }
  332. +     }
  333. + }
  334. + /*
  335. +  * play a sound on the terminal that has this location in view
  336. +  */
  337. + play_in_view_x_y(t_x, t_y, index)
  338. + int    t_x;
  339. + int    t_y;
  340. + int    index;
  341. + {
  342. +     if (!settings.si.no_sound) {
  343. +         int    x, dx, dy;
  344. +         for (x = 0; x < num_terminals; x++) {
  345. +             dx = t_x - terminal[x]->loc.x;
  346. +             dy = t_y - terminal[x]->loc.y;
  347. +             if (dx >= 0 && dx <= ANIM_WIN_WIDTH && dy >= 0 && dy <= ANIM_WIN_HEIGHT &&
  348. +                 terminal[x]->rplay_fd > 0 && sound_table[terminal[x]->num][index] > 0)
  349. +                 rplay(terminal[x]->rplay_fd, sound_table[terminal[x]->num][index]);
  350. +         }
  351. +     }
  352. + }
  353. + #endif SOUND
  354. Common subdirectories: ./Bin and ../xtank1.3d-sound/Bin
  355. Common subdirectories: ./Doc and ../xtank1.3d-sound/Doc
  356. Common subdirectories: ./Help and ../xtank1.3d-sound/Help
  357. diff -c -r ./Imakefile.Config ../xtank1.3d-sound/Imakefile.Config
  358. *** ./Imakefile.Config    Sun Feb  9 21:28:45 1992
  359. --- ../xtank1.3d-sound/Imakefile.Config    Wed Jun 24 12:55:14 1992
  360. ***************
  361. *** 152,162 ****
  362.   /**/# recreate the bug!)
  363.   /**/# Most sites should leave it undefined.
  364.   /**/#
  365.   /**/# Everybody needs to know the following global things about xtank
  366.   
  367.   DEFINES2        = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \
  368.           -DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \
  369. !         -DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES)
  370.   
  371.   DEFINES         = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \
  372.           -DALLDEFINES="\"$(DEFINES2)\""
  373. --- 152,167 ----
  374.   /**/# recreate the bug!)
  375.   /**/# Most sites should leave it undefined.
  376.   /**/#
  377. + /**/# -DSOUND
  378. + /**/# Enable only if you are using a Sun with sound support.
  379. + /**/# You must also have the rplay sound package for sound to work.
  380. + /**/#
  381.   /**/# Everybody needs to know the following global things about xtank
  382.   
  383.   DEFINES2        = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \
  384.           -DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \
  385. !         -DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES) \
  386. !         -DSOUND
  387.   
  388.   DEFINES         = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \
  389.           -DALLDEFINES="\"$(DEFINES2)\""
  390. Common subdirectories: ./Mazes and ../xtank1.3d-sound/Mazes
  391. Common subdirectories: ./Programs and ../xtank1.3d-sound/Programs
  392. Only in ../xtank1.3d-sound: Sounds
  393. Common subdirectories: ./Src and ../xtank1.3d-sound/Src
  394. Common subdirectories: ./Todo and ../xtank1.3d-sound/Todo
  395. Common subdirectories: ./Util and ../xtank1.3d-sound/Util
  396. Common subdirectories: ./Vehicles and ../xtank1.3d-sound/Vehicles
  397. diff -c -r ./Bin/xtank ../xtank1.3d-sound/Bin/xtank
  398. *** ./Bin/xtank    Sat Feb  1 14:00:59 1992
  399. --- ../xtank1.3d-sound/Bin/xtank    Wed Jul  8 09:58:57 1992
  400. ***************
  401. *** 3,8 ****
  402. --- 3,9 ----
  403.   XTANK_VEHICLES=Vehicles
  404.   XTANK_MAZES=Mazes
  405.   XTANK_PROGRAMS=Programs
  406. + XTANK_SOUNDS=Sounds
  407.   
  408.   #
  409.   # rpotter thinks this is a kludge, I think it is funny! (lidl)
  410. Common subdirectories: ./Doc/Src and ../xtank1.3d-sound/Doc/Src
  411. Common subdirectories: ./Programs/Old and ../xtank1.3d-sound/Programs/Old
  412. Common subdirectories: ./Programs/Old/Old and ../xtank1.3d-sound/Programs/Old/Old
  413. Common subdirectories: ./Src/Fixed-Point and ../xtank1.3d-sound/Src/Fixed-Point
  414. diff -c -r ./Src/Imakefile ../xtank1.3d-sound/Src/Imakefile
  415. *** ./Src/Imakefile    Sun Feb  9 21:46:14 1992
  416. --- ../xtank1.3d-sound/Src/Imakefile    Wed Jun 24 12:55:16 1992
  417. ***************
  418. *** 17,23 ****
  419.                       objects.c program.c radar.c repair.c scroll.c setup.c \
  420.                       setups.c status.c sysdep.c thread.c unix.c update.c \
  421.                       util.c vdesign.c vehicle.c newfile.c vload.c \
  422. !                     version.c $(SRCS2)
  423.                OBJS = 3d.o XMultiSync.o actions.o animate.o box.o collision.o \
  424.                       console.o cosell.o display.o escher.o explosion.o \
  425.                       file.o game.o gr.o graphics.o highlib.o hit.o icounter.o \
  426. --- 17,23 ----
  427.                       objects.c program.c radar.c repair.c scroll.c setup.c \
  428.                       setups.c status.c sysdep.c thread.c unix.c update.c \
  429.                       util.c vdesign.c vehicle.c newfile.c vload.c \
  430. !                     sound.c version.c $(SRCS2)
  431.                OBJS = 3d.o XMultiSync.o actions.o animate.o box.o collision.o \
  432.                       console.o cosell.o display.o escher.o explosion.o \
  433.                       file.o game.o gr.o graphics.o highlib.o hit.o icounter.o \
  434. ***************
  435. *** 26,32 ****
  436.                       objects.o program.o radar.o repair.o scroll.o setup.o \
  437.                       setups.o status.o sysdep.o thread.o unix.o update.o \
  438.                       util.o vdesign.o vehicle.o newfile.o vload.o \
  439. !                     version.o $(OBJS2)
  440.                INCL = Include/bullet.h Include/common.h Include/cosell.h \
  441.                       Include/disc.h Include/game.h Include/globals.h \
  442.                       Include/gr.h Include/graphics.h Include/icounter.h \
  443. --- 26,32 ----
  444.                       objects.o program.o radar.o repair.o scroll.o setup.o \
  445.                       setups.o status.o sysdep.o thread.o unix.o update.o \
  446.                       util.o vdesign.o vehicle.o newfile.o vload.o \
  447. !                     sound.o version.o $(OBJS2)
  448.                INCL = Include/bullet.h Include/common.h Include/cosell.h \
  449.                       Include/disc.h Include/game.h Include/globals.h \
  450.                       Include/gr.h Include/graphics.h Include/icounter.h \
  451. ***************
  452. *** 40,46 ****
  453.                       Include/terminal.h Include/thread.h Include/tread-defs.h \
  454.                       Include/types.h Include/vdesc.h Include/vehicle.h \
  455.                       Include/vehicleparts.h Include/vstructs.h \
  456. !                     Include/weapon-defs.h Include/xtank.h Include/xtanklib.h
  457.               XINCL = Include/Xlibos.h Include/x11.h
  458.   
  459.   /**/# Note that both x11.c and mazeconv.c are included in other .c files,
  460. --- 40,47 ----
  461.                       Include/terminal.h Include/thread.h Include/tread-defs.h \
  462.                       Include/types.h Include/vdesc.h Include/vehicle.h \
  463.                       Include/vehicleparts.h Include/vstructs.h \
  464. !                     Include/weapon-defs.h Include/xtank.h Include/xtanklib.h \
  465. !                     Include/sound.h
  466.               XINCL = Include/Xlibos.h Include/x11.h
  467.   
  468.   /**/# Note that both x11.c and mazeconv.c are included in other .c files,
  469. ***************
  470. *** 52,58 ****
  471.   
  472.   /**/# Everybody needs the following libraries
  473.   
  474. !   EXTRA_LIBRARIES = -LPrograms -lxtankrobots -lm
  475.   
  476.   /**/# Start of System Dependent Things
  477.   /**/# (e.g. libraries, linker flags and so forth)
  478. --- 53,59 ----
  479.   
  480.   /**/# Everybody needs the following libraries
  481.   
  482. !   EXTRA_LIBRARIES = -LPrograms -lxtankrobots -lm -L/usr/local/lib -lrplay
  483.   
  484.   /**/# Start of System Dependent Things
  485.   /**/# (e.g. libraries, linker flags and so forth)
  486. ***************
  487. *** 89,95 ****
  488.   #endif
  489.   #ifdef SunArchitecture
  490.       SYS_LIBRARIES = /usr/lib/debug/malloc.o -llwp
  491. !         CCOPTIONS = -Bstatic
  492.   #ifdef SparcArchitecture
  493.   /**/# Sun4
  494.   #else
  495. --- 90,96 ----
  496.   #endif
  497.   #ifdef SunArchitecture
  498.       SYS_LIBRARIES = /usr/lib/debug/malloc.o -llwp
  499. !         CCOPTIONS = /**/#-Bstatic
  500.   #ifdef SparcArchitecture
  501.   /**/# Sun4
  502.   #else
  503. Common subdirectories: ./Src/Include and ../xtank1.3d-sound/Src/Include
  504. Common subdirectories: ./Src/Objects and ../xtank1.3d-sound/Src/Objects
  505. Common subdirectories: ./Src/Old and ../xtank1.3d-sound/Src/Old
  506. Common subdirectories: ./Src/Programs and ../xtank1.3d-sound/Src/Programs
  507. diff -c -r ./Src/explosion.c ../xtank1.3d-sound/Src/explosion.c
  508. *** ./Src/explosion.c    Sun Feb  9 21:45:40 1992
  509. --- ../xtank1.3d-sound/Src/explosion.c    Mon Jul  6 09:41:12 1992
  510. ***************
  511. *** 13,20 ****
  512.   #include "bullet.h"
  513.   #include "graphics.h"
  514.   #include "loc.h"
  515.   
  516.   #define EXP_SPREAD 15
  517.   
  518.   
  519. --- 13,22 ----
  520.   #include "bullet.h"
  521.   #include "graphics.h"
  522.   #include "loc.h"
  523. + #ifdef SOUND
  524. + #include "sound.h"
  525. + #endif SOUND
  526.   
  527.   #define EXP_SPREAD 15
  528.   
  529.   
  530. ***************
  531. *** 32,37 ****
  532. --- 34,75 ----
  533.   
  534.       if (eset->number >= MAX_EXPS)
  535.       return;
  536. + #ifdef SOUND
  537. +     switch (type) {
  538. +         case EXP_TANK:
  539. +             play_in_view(loc, TANK_EXPLOSION_SOUND);
  540. +             break;
  541. +         case EXP_GLEAM:
  542. +             play_in_view(loc, GLEAM_EXPLOSION_SOUND);
  543. +             break;
  544. +         case EXP_DAM0:
  545. +             play_in_view(loc, DAM0_EXPLOSION_SOUND);
  546. +             break;
  547. +         case EXP_DAM1:
  548. +              play_in_view(loc, DAM1_EXPLOSION_SOUND);
  549. +             break;
  550. +        case EXP_DAM2:
  551. +             play_in_view(loc, DAM2_EXPLOSION_SOUND);
  552. +             break;
  553. +         case EXP_DAM3:
  554. +             play_in_view(loc, DAM3_EXPLOSION_SOUND);
  555. +             break;
  556. +         case EXP_DAM4:
  557. +             play_in_view(loc, DAM4_EXPLOSION_SOUND);
  558. +             break;
  559. +         case EXP_EXHAUST:
  560. +             play_in_view(loc, EXHAUST_EXPLOSION_SOUND);
  561. +             break;
  562. +         case EXP_ELECTRIC:
  563. +             play_in_view(loc, ELECTRIC_EXPLOSION_SOUND);
  564. +             break;
  565. +         default:
  566. +             play_in_view(loc, DAMAGE_EXPLOSION_SOUND);
  567. +             break;
  568. +     }
  569. + #endif SOUND
  570.       e = eset->list[eset->number++];
  571.       e->x = (int) loc->x;
  572.       e->y = (int) loc->y;
  573. ***************
  574. *** 58,63 ****
  575. --- 96,102 ----
  576.       int exp_dx, exp_dy;
  577.       int i;
  578.   
  579. +    
  580.       for (i = 0; i < num; i++) {
  581.       exp_loc = *loc;
  582.       exp_dx = rnd(EXP_SPREAD << 1) - EXP_SPREAD;
  583. diff -c -r ./Src/file.c ../xtank1.3d-sound/Src/file.c
  584. *** ./Src/file.c    Sun Feb  9 21:45:41 1992
  585. --- ../xtank1.3d-sound/Src/file.c    Wed Jul  8 09:30:04 1992
  586. ***************
  587. *** 120,125 ****
  588. --- 120,128 ----
  589.   char pathname[MAXPATHLEN];
  590.   char headersdir[MAXPATHLEN];    /* full name of directory to find headers in */
  591.   char vehiclesdir[MAXNAMLEN], mazesdir[MAXNAMLEN], programsdir[MAXNAMLEN];
  592. + #ifdef SOUND
  593. + char soundsdir[MAXPATHLEN];
  594. + #endif SOUND
  595.   char username[MAX_STRING], displayname[256];
  596.   
  597.   #ifdef NEED_AUX_FONT
  598. ***************
  599. *** 168,174 ****
  600.       (void) strcpy(filename, "XVDIR:list");
  601.   #endif /* AMIGA */
  602.   
  603. !     draw_text_rc(ANIM_WIN, 0, 1, "Reading vehicle list...", M_FONT, WHITE);
  604.       sync_output(TRUE);
  605.       if ((file = fopen(filename, "r")) != NULL)
  606.       {
  607. --- 171,177 ----
  608.       (void) strcpy(filename, "XVDIR:list");
  609.   #endif /* AMIGA */
  610.   
  611. !     draw_text_rc(ANIM_WIN, 0, 2, "Reading vehicle list...", M_FONT, WHITE);
  612.       sync_output(TRUE);
  613.       if ((file = fopen(filename, "r")) != NULL)
  614.       {
  615. ***************
  616. *** 196,202 ****
  617.       (void) strcpy(filename, "XMDIR:list");
  618.   #endif /* AMIGA */
  619.   
  620. !     draw_text_rc(ANIM_WIN, 0, 2, "Reading maze list...", M_FONT, WHITE);
  621.       sync_output(TRUE);
  622.       if ((file = fopen(filename, "r")) != NULL)
  623.       {
  624. --- 199,205 ----
  625.       (void) strcpy(filename, "XMDIR:list");
  626.   #endif /* AMIGA */
  627.   
  628. !     draw_text_rc(ANIM_WIN, 0, 3, "Reading maze list...", M_FONT, WHITE);
  629.       sync_output(TRUE);
  630.       if ((file = fopen(filename, "r")) != NULL)
  631.       {
  632. ***************
  633. *** 729,734 ****
  634. --- 732,740 ----
  635.       strcpy(vehiclesdir, (p = getenv("XTANK_VEHICLES")) ? p : "Vehicles");
  636.       strcpy(mazesdir, (p = getenv("XTANK_MAZES")) ? p : "Mazes");
  637.       strcpy(programsdir, (p = getenv("XTANK_PROGRAMS")) ? p : "Programs");
  638. + #ifdef SOUND
  639. +     strcpy(soundsdir, (p = getenv("XTANK_SOUNDS")) ? p : "Sounds");
  640. + #endif SOUND
  641.       if ((p = getenv("XTANK_HEADERS")) != NULL) {
  642.           strcpy(headersdir, p);
  643.       } else {
  644. diff -c -r ./Src/gr.c ../xtank1.3d-sound/Src/gr.c
  645. *** ./Src/gr.c    Sun Feb  9 21:45:43 1992
  646. --- ../xtank1.3d-sound/Src/gr.c    Wed Jun 24 12:55:17 1992
  647. ***************
  648. *** 134,139 ****
  649. --- 134,143 ----
  650.       /* Initialize 3D values for terminal */
  651.       init_terminal_3d(t);
  652.   
  653. + #ifdef SOUND
  654. +     init_terminal_sound(t);
  655. + #endif SOUND
  656.       return 0;
  657.   }
  658.   
  659. ***************
  660. *** 174,179 ****
  661. --- 178,188 ----
  662.   close_terminal(t)
  663.   Terminal *t;
  664.   {
  665. + #ifdef SOUND
  666. +     if (t->rplay_fd > 0) {
  667. +         close(t->rplay_fd);
  668. +     }
  669. + #endif SOUND
  670.       close_video((Video *) t->video);
  671.       free((char *) t);
  672.   }
  673. diff -c -r ./Src/hit.c ../xtank1.3d-sound/Src/hit.c
  674. *** ./Src/hit.c    Sun Feb  9 21:45:45 1992
  675. --- ../xtank1.3d-sound/Src/hit.c    Mon Jul  6 09:29:07 1992
  676. ***************
  677. *** 52,59 ****
  678.   #include "terminal.h"
  679.   #include "cosell.h"
  680.   #include "globals.h"
  681.   
  682.   extern Map real_map;
  683.   extern Settings settings;
  684.   
  685. --- 52,61 ----
  686.   #include "terminal.h"
  687.   #include "cosell.h"
  688.   #include "globals.h"
  689. + #ifdef SOUND
  690. + #include "sound.h"
  691. + #endif SOUND
  692.   
  693.   extern Map real_map;
  694.   extern Settings settings;
  695.   
  696. ***************
  697. *** 98,103 ****
  698. --- 100,109 ----
  699.       Side side;
  700.       int has_ramplate1, has_ramplate2;
  701.   
  702. + #ifdef SOUND
  703. +     play_in_view(v1->loc, VEHICLE_HIT_VEHICLE_SOUND);
  704. + #endif SOUND
  705.   #ifdef GDEBUG
  706.       int itemp1, itemp2;
  707.       static FILE *statfile = NULL;
  708. ***************
  709. *** 196,201 ****
  710. --- 202,211 ----
  711.       int dx, dy, damage, damage1, damage2;
  712.       int has_ramplate = FALSE;
  713.   
  714. + #ifdef SOUND
  715. +     play_in_view(v->loc, VEHICLE_HIT_WALL_SOUND); 
  716. + #endif SOUND
  717.   #ifdef GDEBUG
  718.       int itemp1, itemp2;
  719.       static FILE *statfile = NULL;
  720. ***************
  721. *** 596,601 ****
  722. --- 606,614 ----
  723.       b->flags &= ~wl;
  724.       /* tell all the combatants to update their map */
  725.       invalidate_maps();
  726. + #ifdef SOUND
  727. +     play_in_view_x_y(x, y, TANK_EXPLOSION_SOUND);
  728. + #endif SOUND
  729.       }
  730.   
  731.       return damage;
  732. diff -c -r ./Src/init.c ../xtank1.3d-sound/Src/init.c
  733. *** ./Src/init.c    Sun Feb  9 21:45:47 1992
  734. --- ../xtank1.3d-sound/Src/init.c    Mon Jul  6 11:37:06 1992
  735. ***************
  736. *** 94,99 ****
  737. --- 94,102 ----
  738.           FALSE,        /* Boolean no_nametags */
  739.           TRUE,       /* Boolean team_score GHS */
  740.           FALSE,        /* Boolean no_radar */
  741. + #ifdef SOUND
  742. +         FALSE,        /* Boolean no_sound */
  743. + #endif SOUND
  744.   
  745.           10000,        /* int winning_score GHS */
  746.           20,            /* int takeover_time */
  747. diff -c -r ./Src/interface.c ../xtank1.3d-sound/Src/interface.c
  748. *** ./Src/interface.c    Wed Feb 12 22:10:34 1992
  749. --- ../xtank1.3d-sound/Src/interface.c    Mon Jul  6 11:37:37 1992
  750. ***************
  751. *** 205,211 ****
  752.               "No wear", "Restart", "Commentator", "Full map",
  753.               "Pay to Play", "Robots don't Win",
  754.               "Scale Armor to Max", "No name tags",
  755. !             "Team Scoring","Disable RADAR"
  756.               },
  757.       *programs_entries[MAX_PDESCS],
  758.       *players_entries[MAX_TERMINALS];
  759. --- 205,214 ----
  760.               "No wear", "Restart", "Commentator", "Full map",
  761.               "Pay to Play", "Robots don't Win",
  762.               "Scale Armor to Max", "No name tags",
  763. !             "Team Scoring","Disable RADAR",
  764. ! #ifdef SOUND
  765. !                         "Disable Sound"
  766. ! #endif SOUND
  767.               },
  768.       *programs_entries[MAX_PDESCS],
  769.       *players_entries[MAX_TERMINALS];
  770. ***************
  771. *** 293,300 ****
  772.           menu_set_hil(&menu_sys, FLAGS_MENU, 10);
  773.       if (settings.si.team_score)
  774.           menu_set_hil(&menu_sys, FLAGS_MENU, 11);
  775. !     if (settings.si.no_radar)
  776.           menu_set_hil(&menu_sys, FLAGS_MENU, 12);
  777.   
  778.   }
  779.   
  780. --- 296,307 ----
  781.           menu_set_hil(&menu_sys, FLAGS_MENU, 10);
  782.       if (settings.si.team_score)
  783.           menu_set_hil(&menu_sys, FLAGS_MENU, 11);
  784. !     if (settings.si.no_radar)
  785.           menu_set_hil(&menu_sys, FLAGS_MENU, 12);
  786. + #ifdef SOUND
  787. +     if (settings.si.no_sound)
  788. +         menu_set_hil(&menu_sys, FLAGS_MENU, 13);
  789. + #endif SOUND
  790.   
  791.   }
  792.   
  793. ***************
  794. *** 729,734 ****
  795. --- 736,746 ----
  796.           case 12:
  797.               settings.si.no_radar ^= TRUE;
  798.               break;
  799. + #ifdef SOUND
  800. +         case 13:
  801. +             settings.si.no_sound ^= TRUE;
  802. +             break;
  803. + #endif SOUND
  804.       }
  805.   }
  806.   
  807. diff -c -r ./Src/lowlib.c ../xtank1.3d-sound/Src/lowlib.c
  808. *** ./Src/lowlib.c    Sun Feb  9 21:45:52 1992
  809. --- ../xtank1.3d-sound/Src/lowlib.c    Wed Jul  8 10:04:36 1992
  810. ***************
  811. *** 73,78 ****
  812. --- 73,81 ----
  813.   #include "cosell.h"
  814.   #include "outpost.h"
  815.   #include "globals.h"
  816. + #ifdef SOUND
  817. + #include "sound.h"
  818. + #endif SOUND
  819.   
  820.   extern Weapon_stat weapon_stat[];
  821.   extern Armor_stat armor_stat[];
  822. ***************
  823. *** 684,689 ****
  824. --- 687,760 ----
  825.   #endif /* !NO_NEW_RADAR */
  826.           make_bullet(cv, &bloc, w->type, angle + PI / 100 * (50 - rnd(101)) / 50);
  827.       }
  828. + #ifdef SOUND
  829. +     switch(w->type) {
  830. +     case LMG:
  831. +         play_in_view(cv->loc, LMG_SOUND);
  832. +         break;
  833. +     case MG:
  834. +         play_in_view(cv->loc, MG_SOUND);
  835. +         break;
  836. +     case HMG:
  837. +         play_in_view(cv->loc, HMG_SOUND);
  838. +         break;
  839. +     case LRIFLE:
  840. +         play_in_view(cv->loc, LRIFLE_SOUND);
  841. +         break;
  842. +     case RIFLE:
  843. +         play_in_view(cv->loc, RIFLE_SOUND);
  844. +         break;
  845. +     case HRIFLE:
  846. +         play_in_view(cv->loc, HRIFLE_SOUND);
  847. +         break;
  848. +     case LCANNON:
  849. +         play_in_view(cv->loc, LCANNON_SOUND);
  850. +         break;
  851. +     case CANNON:
  852. +         play_in_view(cv->loc, CANNON_SOUND);
  853. +         break;
  854. +     case HCANNON:
  855. +         play_in_view(cv->loc, HCANNON_SOUND);
  856. +         break;
  857. +     case LROCKET:
  858. +         play_in_view(cv->loc, LROCKET_SOUND);
  859. +         break;
  860. +     case ROCKET:
  861. +         play_in_view(cv->loc, ROCKET_SOUND);
  862. +         break;
  863. +     case HROCKET:
  864. +         play_in_view(cv->loc, HROCKET_SOUND);
  865. +         break;
  866. +     case ACID:
  867. +         play_in_view(cv->loc, ACID_SOUND);
  868. +         break;
  869. +     case FLAME:
  870. +         play_in_view(cv->loc, FLAME_SOUND);
  871. +         break;
  872. +     case MINE:
  873. +         play_in_view(cv->loc, MINE_SOUND);
  874. +         break;
  875. +     case SEEKER:
  876. +         play_in_view(cv->loc, SEEKER_SOUND);
  877. +         break;
  878. +     case SLICK:
  879. +         play_in_view(cv->loc, SLICK_SOUND);
  880. +         break;
  881. +     case PROCKET:
  882. +         play_in_view(cv->loc, PROCKET_SOUND);
  883. +         break;
  884. +     case UMISSLE:
  885. +         play_in_view(cv->loc, UMISSLE_SOUND);
  886. +         break;
  887. +     case HARM:
  888. +         play_in_view(cv->loc, HARM_SOUND);
  889. +         break;
  890. +     case DISC:
  891. +         play_in_view(cv->loc, DISC_SOUND);
  892. +         break;
  893. +     }
  894. + #endif SOUND
  895.       }
  896.   
  897.       check_time();
  898. diff -c -r ./Src/main.c ../xtank1.3d-sound/Src/main.c
  899. *** ./Src/main.c    Sun Feb  9 21:45:53 1992
  900. --- ../xtank1.3d-sound/Src/main.c    Wed Jun 24 12:55:18 1992
  901. ***************
  902. *** 252,257 ****
  903. --- 252,258 ----
  904.       debug("Opening graphics toolkit");
  905.       open_graphics();
  906.   
  907.       /* Parse command line for display names and make a terminal for each one */
  908.       debug("Making terminals");
  909.       if (argc - iNumOpts > 1)
  910. diff -c -r ./Src/radar.c ../xtank1.3d-sound/Src/radar.c
  911. *** ./Src/radar.c    Sun Feb  9 21:46:03 1992
  912. --- ../xtank1.3d-sound/Src/radar.c    Wed Jul  8 10:08:55 1992
  913. ***************
  914. *** 45,50 ****
  915. --- 45,53 ----
  916.   #include "map.h"
  917.   #include "vehicle.h"
  918.   #include "globals.h"
  919. + #ifdef SOUND
  920. + #include "sound.h"
  921. + #endif SOUND
  922.   
  923.   extern Map real_map;
  924.   Boolean traceaction = FALSE;
  925. ***************
  926. *** 118,124 ****
  927.       int init_x, init_y;
  928.       int x, y;
  929.       int i;
  930.       r = (Radar *) record;
  931.   
  932.       switch (action)
  933. --- 121,127 ----
  934.       int init_x, init_y;
  935.       int x, y;
  936.       int i;
  937. !     
  938.       r = (Radar *) record;
  939.   
  940.       switch (action)
  941. ***************
  942. *** 170,175 ****
  943. --- 173,181 ----
  944.           /* If there is a vehicle in this box, make a blip */
  945.           if (vehicle_flags)
  946.           {
  947. + #ifdef SOUND
  948. +         play_owner(v, BLIP_SOUND);
  949. + #endif SOUND
  950.           b = &r->blip[r->num_blips++];
  951.           b->x = grid2map(x) + MAP_BOX_SIZE / 4;
  952.           b->y = grid2map(y) + MAP_BOX_SIZE / 4;
  953. ***************
  954. *** 182,187 ****
  955. --- 188,194 ----
  956.       /* Increment the position counter modulo 24 */
  957.       if (++r->pos == 24)
  958.           r->pos = 0;
  959. +     
  960.   
  961.       /* Save the old sweeper position, and compute the new one */
  962.       r->old_start_x = r->start_x;
  963. diff -c -r ./Src/setup.c ../xtank1.3d-sound/Src/setup.c
  964. *** ./Src/setup.c    Sun Feb  9 21:46:05 1992
  965. --- ../xtank1.3d-sound/Src/setup.c    Wed Jul  8 10:28:39 1992
  966. ***************
  967. *** 55,60 ****
  968. --- 55,63 ----
  969.   #include "thread.h"
  970.   #include "globals.h"
  971.   #include "assert.h"
  972. + #ifdef SOUND
  973. + #include "sound.h"
  974. + #endif SOUND
  975.   
  976.   extern Map real_map;
  977.   extern Boolean game_paused;
  978. ***************
  979. *** 279,287 ****
  980. --- 282,298 ----
  981.   
  982.       game_running = True;
  983.   
  984. + #ifdef SOUND
  985. +     play_all(START_SOUND);
  986. + #endif SOUND
  987.       do {
  988.           status = animate();
  989.       } while (status == GAME_RUNNING);
  990. + #ifdef SOUND
  991. +     play_all(END_SOUND);
  992. + #endif SOUND
  993.   
  994.       game_running = False;
  995.   
  996. Only in ../xtank1.3d-sound/Src: sound.c
  997. diff -c -r ./Src/Include/settings.h ../xtank1.3d-sound/Src/Include/settings.h
  998. *** ./Src/Include/settings.h    Tue Feb  4 00:03:13 1992
  999. --- ../xtank1.3d-sound/Src/Include/settings.h    Mon Jul  6 11:36:33 1992
  1000. ***************
  1001. *** 18,23 ****
  1002. --- 18,26 ----
  1003.       Boolean no_nametags;    /* whether vehicles are anonymous */
  1004.       Boolean team_score;        /* whether to use team scoring */
  1005.       Boolean no_radar;        /* turns everyone's radar off */
  1006. + #ifdef SOUND
  1007. +     Boolean no_sound;           /* turns everyone's sound off */
  1008. + #endif SOUND
  1009.       int winning_score;        /* score needed to win the game */
  1010.       int takeover_time;        /* how long you have to be in a square in order
  1011.                      to capture it (in War game) */
  1012. Only in ../xtank1.3d-sound/Src/Include: sound.h
  1013. diff -c -r ./Src/Include/terminal.h ../xtank1.3d-sound/Src/Include/terminal.h
  1014. *** ./Src/Include/terminal.h    Sat Jan 25 21:02:03 1992
  1015. --- ../xtank1.3d-sound/Src/Include/terminal.h    Wed Jun 24 12:55:19 1992
  1016. ***************
  1017. *** 52,57 ****
  1018. --- 52,60 ----
  1019.       Line  line[MAX_LINES];    /* lines drawn on the screen */
  1020.       Boolean observer;        /* True if this terminal is not controlling a
  1021.                      vehicle */
  1022. + #ifdef SOUND
  1023. +     int   rplay_fd;
  1024. + #endif SOUND
  1025.   } Terminal;
  1026.   
  1027.